﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<WebManageUser_Strategy>" %>

<%@ Import Namespace="EF.Commons.Background.Entity" %>
<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
    员工管理－登陆管理
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <link href="/Content/style/validate.css" rel="stylesheet" type="text/css" />
    <h1>
        <span class="action-span1"><a href="javascript:void(0);" target="_self">系统管理</a> - 员工管理－登陆管理</span>
        <div style="clear: both">
        </div>
    </h1>
    <form action="/System/WebManageLogin" method="post" id="form1" onsubmit="return checkIP()">
    <table style="width: 100%" class="datail_table">
        <tr>
            <td class="label" style="width: 60px;" valign="top">
                ID：
            </td>
            <td align="left">
                <%=Request.QueryString["id"]%>
                <input type="hidden" name="id" value="<%=Request.QueryString["id"] %>" />
            </td>
        </tr>
        <tr>
            <td class="label" style="width: 60px;" valign="top">
                后台用户ID：
            </td>
            <td align="left">
                <%=Request.QueryString["userid"]%>
                <input type="hidden" name="manageUserID" value="<%=Request.QueryString["userid"] %>" />
            </td>
        </tr>
        <tr>
            <td class="label" style="width: 100px">
                IP地址区范围：
            </td>
            <td align="left">
                <input id="IPArea" name="IPArea" validate="{required:true}" value="<%=Model!=null ? Model.IPArea : ""%>"
                    onkeyup="checkIP()" /><div id="errorInfo" style="display: none;">
                        你输入的是一个非法的IP地址段!IP段为：:xxx.xxx.xxx.xxx（xxx为0-255)或*.*.*.*!
                    </div>
            </td>
        </tr>
        <tr>
            <td class="label" style="width: 100px;" valign="top">
                策略起始时间：
            </td>
            <td align="left">
                <input type="text" id="beginDate" name="beginDate" value="<%=Model != null ? Model.BeginDate.ToString("yyyy-MM-dd") : DateTime.Now.ToString("yyyy-MM-dd")%>"
                    style="width: 130px; cursor: pointer" onfocus="WdatePicker({isShowClear:false,readOnly:false})"
                    validate="{required:true}" />
            </td>
        </tr>
        <tr>
            <td class="label" style="width: 100px;" valign="top">
                策略结束时间：
            </td>
            <td align="left">
                <input type="text" id="endDate" name="endDate" value="<%=Model != null ? Model.EndDate.ToString("yyyy-MM-dd") : DateTime.Now.ToString("yyyy-MM-dd")%>"
                    style="width: 130px; cursor: pointer" onfocus="WdatePicker({isShowClear:false,readOnly:false})"
                    validate="{required:true}" />
            </td>
        </tr>
        <tr>
            <td class="label" style="width: 60px;" valign="top">
                状态：
            </td>
            <td align="left">
                <%=Html.StatusForSelectList() %>
            </td>
        </tr>
        <tr>
            <td colspan="2" align="center">
                <%=Html.CreateButton(UserOperatorRole.AddEvent) %>
                <%: Html.ActionLink("返  回", "WebManageLoginList", new { id = Request.QueryString["userid"], Page = Request.QueryString["page"] }, UserOperatorRole.ModifyEvent)%>
            </td>
        </tr>
    </table>
    </form>
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="ScriptContent" runat="server">
    <script type="text/javascript" language="javascript">
        $(function () {
            if (InitValidate("form1")) {
                checkIP();
                document.getElementById("form1").submit();
            }

            if ("" != '<%=Request.QueryString["res"]%>') {
                art.dialog(
                {
                    content: '操作成功',
                    width: 350,
                    height: 40
                }, function () {
                    location.href = "/System/WebManageLoginList?id=" + '<%=Request.QueryString["userid"]%>';
                });
            }
        })
        function checkIP() {
            var sIPAddress = document.getElementById("IPArea").value;
            //var ipAddr = sIPAddress.substring(0, sIPAddress.lastIndexOf('.'));     //截取IP地址中最后一个.前面的数字  

            var exp = /^(\d{1,2}|1\d\d|2[0-4]\d|25[0-5]|\*)\.(\d{1,2}|1\d\d|2[0-4]\d|25[0-5]|\*)\.(\d{1,2}|1\d\d|2[0-4]\d|25[0-5]|\*)\.(\d{1,2}|1\d\d|2[0-4]\d|25[0-5]|\*)$/;
            var reg = sIPAddress.match(exp);
            //var ErrMsg = "你输入的是一个非法的IP地址段!\nIP段为：:xxx.xxx.xxx.xxx（xxx为0-255)\n或xxx.xxx.xxx.*（xxx为0-255)! ";
            if (sIPAddress != "") {
                if (reg == null) {
                    //alert(ErrMsg);
                    document.getElementById("errorInfo").style.display = "block";
                    return false;
                }
            }
            document.getElementById("errorInfo").style.display = "none";
            return true;
        }   
    </script>
</asp:Content>
